package view;

import javax.swing.JPanel;

import view.user.Settings;
import view.user.Balance;
import view.user.CreateAccount;
import view.user.Deposit;
import view.user.Leaderboard;
import view.user.Login;
import view.user.Statistics;
import view.user.Transfer;
import view.user.Withdrawal;

import controller.KeyHandler;
import controller.TableHandler;
import controller.SlideHandler;
import controller.ActionEvents.ActionHandler;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
/**
 * 
 * @author Christian
 * JPanel contains CardLayout the user can flip through.
 * @see java.awt.Container
 */
public class CenterPanel extends JPanel 
{
	/**
	 * Declares classes as object, in order to be used in the methods.
	 */
	private ActionHandler actionHandler;
	private CardLayout cl_contentPane;
	private Deposit deposit;
	private Withdrawal withdraw;
	private Leaderboard leaderboard;
	private Balance balance;
	private Settings settings;
	private Transfer transfer;
	private Login login;
	private Statistics statistics;
	private CreateAccount createAccount;
	
	/**
	 * Constructor creates the JPanel container using CardLayout.
	 * @param ActionHandler is passed every time the user changes Card in the CardLayout.
	 */
	public CenterPanel(ActionHandler actionHandler, SlideHandler slideHandler, KeyHandler keyHandler) 
	{
		setPreferredSize(new Dimension(800, 372));
		setLayout(new CardLayout(0, 0));
		setBackground(Color.WHITE);
		this.actionHandler = actionHandler;
		
		
		balance = new Balance(actionHandler);
		add(balance,"BALANCE"); // String "BALANCE" is recognized by the ActListener.
		
		deposit = new Deposit(actionHandler);
		add(deposit,"DEPOSIT"); // String "DEPOSIT" is recognized by the ActListener.
		
		withdraw =new Withdrawal(actionHandler);
		add(withdraw,"WITHDRAWAL"); // String "WITHDRAW" is recognized by the ActListener.
		
		leaderboard = new Leaderboard(actionHandler);
		add(leaderboard,"LEADERBOARD"); // String "LEADERBOARD" is recognized by the ActListener.
		
		settings = new Settings(actionHandler, slideHandler, keyHandler);
		add(settings,"SETTINGS"); // String "ABOUT" is recognized by the ActListener.
		
		transfer = new Transfer(actionHandler);
		add(transfer,"TRANSFER"); // String "TRANSFER" is recognized by the ActListener.
		
//		login = new Login(actionHandler);
//		add(login,"LOGIN"); // String "LOGIN" is recognized by the ActListener.
		
		statistics = new Statistics(actionHandler);
		add(statistics,"STATISTICS");
		
		createAccount = new CreateAccount(actionHandler);
		add(createAccount, "CREATEACCOUNT");
		

		cl_contentPane = (CardLayout) getLayout();
	}
	/**
	 * @return the statistics
	 */
	public Statistics getStatistics() {
		return statistics;
	}
	/**
	 * @param statistics the statistics to set
	 */
	public void setStatistics(Statistics statistics) {
		this.statistics = statistics;
	}
	/**
	 * Method receives data on which card the user wants to flip.
	 * @param card receives card, and flips the card to the top deck of CardLayout.
	 */
	public void show(String card) 
	{
		cl_contentPane.show(this,card);
	}
	/**
	 * @return the deposit
	 */
	public Deposit getDeposit() {
		return deposit;
	}
	/**
	 * @param deposit the deposit to set
	 */
	public void setDeposit(Deposit deposit) {
		this.deposit = deposit;
	}
	/**
	 * @return the withdraw
	 */
	public Withdrawal getWithdrawal() {
		return withdraw;
	}
	/**
	 * @param withdraw the withdraw to set
	 */
	public void setWithdraw(Withdrawal withdraw) {
		this.withdraw = withdraw;
	}
	/**
	 * @return the leaderboard
	 */
	public Leaderboard getLeaderboard() {
		return leaderboard;
	}
	/**
	 * @param leaderboard the leaderboard to set
	 */
	public void setLeaderboard(Leaderboard leaderboard) {
		this.leaderboard = leaderboard;
	}
	/**
	 * @return the balance
	 */
	public Balance getBalance() {
		return balance;
	}
	/**
	 * @param balance the balance to set
	 */
	public void setBalance(Balance balance) {
		this.balance = balance;
	}
	/**
	 * @return the about
	 */
	public Settings getAbout() {
		return settings;
	}
	/**
	 * @param about the about to set
	 */
	public void setAbout(Settings about) {
		this.settings = about;
	}
	/**
	 * @return the transfer
	 */
	public Transfer getTransfer() {
		return transfer;
	}
	/**
	 * @param transfer the transfer to set
	 */
	public void setTransfer(Transfer transfer) {
		this.transfer = transfer;
	}
	/**
	 * @return the login
	 */
//	public Login getLogin() {
//		return login;
//	}
//	/**
//	 * @param login the login to set
//	 */
//	public void setLogin(Login login) {
//		this.login = login;
//	}
	/**
	 * @return the createAccount
	 */
	public CreateAccount getCreateAccount() {
		return createAccount;
	}
	/**
	 * @param createAccount the createAccount to set
	 */
	public void setCreateAccount(CreateAccount createAccount) {
		this.createAccount = createAccount;
	}
	
	
	
	
}
